// 建设项目管理
import request from '@/utils/request'

// 新增项目信息
export function addProjectInfo(data) {
  return request({
    method: 'post',
    url: 'zhjs/project/saveOrUpdate',
    data: data
  })
}

// 查询项目列表
export function queryProjectList(params) {
  return request({
    method: 'get',
    url: 'zhjs/project/query',
    params
  })
}

// 查询项目详情
export function queryProjectDetail(pkid) {
  return request({
    method: 'get',
    url: `zhjs/project/queryById?pkid=${pkid}`
  })
}

// 删除项目
export function deleteProjectInfo(pkid) {
  return request({
    method: 'delete',
    url: `zhjs/project/removeById?pkid=${pkid}`
  })
}

// 解析上传dwg文件
export function dwgFileUpload(data) {
  return request({
    method: 'post',
    url: '/map/map/parse/dwg/geojson',
    data: data
  })
}

// 建设公司选项
export function queryJsgsList() {
  return request({
    method: 'get',
    url: 'zhjs/project/queryJsgs'
  })
}

// 通过id解析dwg
export function dwgFileById(fileId) {
  return request({
    method: 'get',
    url: `/map/map/parse/dwg/fileId?fileId=${fileId}`
  })
}

// 查询审核记录
export function queryCheckInfo(pkid) {
  return request({
    method: 'get',
    url: `zhjs/project/examineHistory?pkid=${pkid}`
  })
}

// 新增审核记录
export function addCheckInfo(data) {
  return request({
    method: 'post',
    url: 'zhjs/project/examine',
    data: data
  })
}

// 项目基本信息导出
export function projectFileDownload(params) {
  return request({
    method: 'get',
    responseType: 'blob',
    params,
    url: `zhjs/project/export`,
    timeout: 0
  })
}
//解析上传shp文件
export function shpFileUpload(data) {
  return request({
    method: 'post',
    url: '/map/map/parse/shp/geojson',
    data: data
  })
}
//通过id解析shp文件
export function shpFileById(fileId) {
  return request({
    method: 'get',
    url: `/map/map/parse/dwg/fileId?fileId=${fileId}`
  })
}

// 查询项目生长树
export function queryEffectPicture(pkid) {
  return request({
    method: 'get',
    url: `zhjs/project/queryEffectPicture?projectId=${pkid}`
  })
}

// 修改记录
export function queryLogList(pkid) {
  return request({
    method: 'get',
    url: `zhjs/log/queryLogList?projectId=${pkid}`
  })
}

// 查询项目是否存在巡查报告和安全检查报告
export function queryJudgeExist(projectId, sectionId) {
  return request({
    method: 'get',
    url: `zhjs/project/judgeExist?projectId=${projectId}&sectionId=${sectionId}`
  })
}
